﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace SHDQGSWEB.Models
{
    public class ConfigRepository
    {
        SHDQGSDBDataContext db = new SHDQGSDBDataContext();
        public IQueryable<Configuration> GetConfiguration(string controller,string action,string part)
        {
            return from config in db.Configuration
                   where config.Controller == controller && config.Action == action && config.Part == part
                   select config;
        }
        public IQueryable<string> GetConfigurationValues(string controller, string action, string part)
        {
            return from config in db.Configuration
                   where config.Controller == controller && config.Action == action && config.Part == part
                   select config.Value;
        }
        
        public void Save()
        {
            db.SubmitChanges();
        }
    }
}